home *** CD-ROM | disk | FTP | other *** search
- function jetpacing()
- {
- var _loc1_ = this;
- lastbx = bx;
- lastby = by;
- bombtrailcount++;
- if(by < 0)
- {
- _loc1_.misslefollow._x = bx;
- }
- else
- {
- _loc1_.misslefollow._x = -10;
- }
- if(xmove > 0)
- {
- rightv = xmove;
- }
- else
- {
- leftv = Math.abs(xmove);
- }
- upv = temppower * Math.sin(radian);
- adjustx = 45 * Math.cos(radian);
- adjusty = 8 + 45 * Math.sin(radian);
- temppower -= gravity;
- upv = temppower * Math.sin(radian);
- if(rightv > 0)
- {
- rightv += windamount;
- if(rightv < 0)
- {
- leftv = Math.abs(rightv);
- rightv = 0;
- }
- }
- if(leftv > 0)
- {
- leftv -= windamount;
- if(leftv < 0)
- {
- rightv = Math.abs(leftv);
- leftv = 0;
- }
- }
- bx += rightv;
- bx -= leftv;
- by += upv;
- if(bx > 780)
- {
- bx = 779;
- leftv = rightv;
- rightv = 0;
- }
- if(bx < 20)
- {
- bx = 21;
- rightv = leftv;
- leftv = 0;
- }
- if(by > 560)
- {
- by = 560;
- hity = 560;
- lastbx = undefined;
- action = "player stops jetpacing";
- }
- hitarraynumlow = Math.floor(bx / landdetail);
- hitarraynumhigh = Math.ceil(bx / landdetail);
- l1y = landarray[hitarraynumlow];
- l2y = landarray[hitarraynumhigh];
- l2x = hitarraynumhigh * landdetail;
- l1x = hitarraynumlow * landdetail;
- bombm = (by - oby) / (bx - obx);
- bombb = by - bombm * bx;
- landm = (l1y - l2y) / (l1x - l2x);
- landb = l1y - landm * l1x;
- hitx = (bombb - landb) / (landm - bombm);
- hity = bombm * hitx + bombb;
- x = hitx;
- y = hity;
- r = bx;
- s = obx;
- t = by;
- u = oby;
- hitline = -10;
- if(hitx < Infinity && hitx > - Infinity && hity < Infinity && hity > - Infinity)
- {
- if(hitx >= bx && hitx <= obx || hitx >= obx && hitx <= bx && (hity >= by && hity <= oby) || hity >= oby && hity <= by)
- {
- hitline = 1;
- }
- if(hitx >= l1x && hitx <= l2x || hitx >= l2x && hitx <= l1x && (hity >= l1y && hity <= l2y) || hity >= l2y && hity <= l1y)
- {
- hitline++;
- }
- if(hitline > 1)
- {
- action = "player stops jetpacing";
- }
- }
- hitarraynum = Math.floor(bx / landdetail);
- hitloc = landarray[hitarraynum];
- if(by >= hitloc)
- {
- hitx = hitarraynum * landdetail;
- hity = hitloc - 40;
- action = "player stops jetpacing";
- }
- _loc1_.jetpac._x = bx;
- _loc1_.jetpac._y = by;
- if(bx < lastbx)
- {
- jetpac._xscale = -100;
- jetd = -100;
- }
- if(bx > lastbx)
- {
- jetpac._xscale = 100;
- jetd = 100;
- }
- a = (bx - lastbx) / (by - lastby);
- b = - Math.asin(a) * 180 / 3.141592653589793;
- if(b < -30)
- {
- b = -30;
- }
- if(b > 30)
- {
- b = 30;
- }
- jetpac._rotation = b;
- bombtrailcount++;
- if(bombtrailcount > 5)
- {
- bombtrailcount = 0;
- landscape.attachMovie("jetpactrail","b" + bombt,bombt);
- bombt++;
- if(bombt > 500)
- {
- bombt = 400;
- }
- }
- }
-